<html>

<head>
    <script type="text/javascript">  
        var ws = new WebSocket("ws://localhost:8010/realtime");
        ws.onmessage = function (event) {
            var div1 = document.createElement("div");
            div1.innerHTML = event.data;
            document.body.appendChild(div1);
        }
        function send() {
            ws.send(document.getElementById('chat').value);
        }
        function stop() {
            ws.send('stop')
        }
    </script>
</head>


<!-- 
    这个示例html实现了:
    
    联入websocket,发送code的请求,并将结果增加到html中

    @yutiansut
    2018/2/16
 -->

<body>
    <div>
        input the code
        <input id="chat">
        <button onclick="send()">send</button>
    </div>

</body>

</html>